import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '退款人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '退款商品',
    align: "center",
    dataIndex: 'goodsName'
  }, {
    title: '退款金额',
    align: "center",
    dataIndex: 'amt'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },

  {
    title: '退款理由',
    align: "center",
    dataIndex: 'reason'
  },
  {
    title: '退款详情',
    align: "center",
    dataIndex: 'description'
  },

  {
    title: '回复',
    align: "center",
    dataIndex: 'reply'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '产业名称',
    align: "center",
    dataIndex: 'nurseType_dictText'
  },
  {
    title: '用户ID',
    align: "center",
    dataIndex: 'userId'
  },

];
//查询数据
export const searchFormSchema: FormSchema[] = [
  // {
  //   label: "订单ID",
  //   field: 'orderId',
  //   component: 'JInput',
  //   //colProps: {span: 6},
  // },
  {
    label: "用户ID",
    field: 'userId',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "状态",
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_refund_type"
    },
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '退款理由',
    field: 'reason',
    component: 'Input',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '退款详情',
    field: 'description',
    component: 'InputTextArea',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '用户ID',
    field: 'userId',
    component: 'Input',
    componentProps: {
      disabled: true
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入用户ID!' },
      ];
    },
  },
  {
    label: '回复',
    field: 'reply',
    component: 'InputTextArea',
  },
  {
    label: '退款商品',
    field: 'goodsName',
    component: 'Input',
    componentProps: {
      disabled: true
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入退款商品!' },
      ];
    },
  },
  {
    label: '产业名称',
    field: 'nurseType',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_type",
      disabled: true
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入产业名称!' },
      ];
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_refund_type",
      // disabled: true
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入状态!' },
      ];
    },
  },
  {
    label: '退款金额',
    field: 'amt',
    component: 'InputNumber',
    componentProps: {
      dictCode: "nurse_type",
      disabled: true
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入退款金额!' },
      ];
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  createTime: { title: '创建时间', order: 0, view: 'datetime', type: 'string', },
  updateTime: { title: '更新时间', order: 1, view: 'datetime', type: 'string', },
  createBy: { title: '创建人', order: 2, view: 'text', type: 'string', },
  updateBy: { title: '更新人', order: 3, view: 'text', type: 'string', },
  reason: { title: '退款理由', order: 4, view: 'text', type: 'string', },
  description: { title: '退款详情', order: 5, view: 'textarea', type: 'string', },
  userId: { title: '用户ID', order: 7, view: 'text', type: 'string', },
  reply: { title: '回复', order: 8, view: 'textarea', type: 'string', },
  goodsName: { title: '退款商品', order: 9, view: 'text', type: 'string', },
  nurseType: { title: '产业名称', order: 10, view: 'list', type: 'string', dictCode: 'nurse_type', },
  status: { title: '状态', order: 11, view: 'radio', type: 'string', },
  amt: { title: '退款金额', order: 12, view: 'number', type: 'number', },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}